/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package etherblocks.game.entitysystem;

/**
 *
 * @author Carl
 */
public class Entity{
    
    public Entity(EntityMap entityMap, int id){
        this.entityMap = entityMap;
        this.id = id;
    }
    private EntityMap entityMap;
    private int id;
    
    public <T> T getComponent(Class<T> componentClass){
        return entityMap.getComponent(id, componentClass);
    }
    
    public void setComponent(Object component){
        entityMap.setComponent(id, component);
    }
    
    public void clearAllComponents(){
        entityMap.clearAllComponents(id);
    }
    
    public void clearComponent(Class componentClass){
        entityMap.clearComponent(id, componentClass);
    }
    
    public void loadTemplate(String templateName){
        EntityTemplate.loadTemplate(this, templateName);
    }

    public EntityMap getEntityMap(){
        return entityMap;
    }

    public int getID(){
        return id;
    }

    @Override
    public String toString(){
        return "[Entity id=" + id + "]";
    }
}
